<%- include('../../common/header') %>

<div class="media text-muted pt-3">
  <a href="/user/<%= user._id %>"><img class="mr-2 rounded" src="/img/<%= user.avatar %>" alt="<%= user.name %>" data-holder-rendered="true" style="width: 32px; height: 32px;"></a>
  <div class="media-body pb-3 mb-0 small lh-125">
    <div class="d-flex justify-content-between align-items-center w-100">
      <strong class="text-gray-dark"><%= user.name %> | <%= ({m: '男', f: '女', x: '保密'})[user.gender] %></strong>
    </div>
    <span class="d-block"><%= user.bio %></span>
  </div>
</div>

<form class="needs-validation" novalidate method="post" enctype="multipart/form-data">
  <h1 class="h3 mb-3 font-weight-normal text-center">发布剧情</h1>
  <div class="form-group">
    <label for="title">标题</label>
    <input type="text" id="title" name="title" class="form-control" required>
  </div>
  <div class="form-group">
    <label for="subTitle">副标题</label>
    <input type="text" id="subTitle" name="subTitle" class="form-control" required>
  </div>
  <div class="form-group">
    <label for="pic">封面</label>
    <div class="custom-file">
      <input type="file" class="custom-file-input" id="pic" name="pic" required>
      <label class="custom-file-label" for="pic">选择封面</label>
    </div>
  </div>
  <div class="form-group">
    <label for="url">链接</label>
    <input type="text" id="url" name="url" class="form-control" required>
  </div>
  <div class="form-group">
    <label for="tags">属性</label>
    <input type="text" id="tags" name="tags" class="form-control" required>
  </div>
  <div class="form-group">
    <label for="source">来源</label>
    <input type="text" id="source" name="source" class="form-control" required>
  </div>
  <div class="form-group">
    <label for="sort">排序</label>
    <input type="text" id="sort" name="sort" class="form-control" required>
  </div>
  <div class="form-group">
    <label for="content">内容</label>
    <textarea class="form-control" id="content" name="content" rows="5" required></textarea>
  </div>
  <button class="btn btn-lg btn-primary btn-block" type="submit">发布</button>
</form>
<script>
// Example starter JavaScript for disabling form submissions if there are invalid fields
(function() {
  'use strict';
  window.addEventListener('load', function() {
    // Fetch all the forms we want to apply custom Bootstrap validation styles to
    var forms = document.getElementsByClassName('needs-validation');
    // Loop over them and prevent submission
    var validation = Array.prototype.filter.call(forms, function(form) {
      form.addEventListener('submit', function(event) {
        if (form.checkValidity() === false) {
          event.preventDefault();
          event.stopPropagation();
        }
        form.classList.add('was-validated');
      }, false);
    });
  }, false);
})();
</script>

<%- include('../../common/footer') %>
